{% extends 'layout.html' %}
{% block content %}
    <div class="container">
        <div class="panel panel-default">
            <div class="panel-heading">
                <span class="glyphicon glyphicon-plus-sign" aria-hidden="true"></span>
                修改密码
            </div>
            <div class="panel-body">
                <form class="form-horizontal" role="form" method="post">
                    {% csrf_token %}
                    <input type="hidden" name="eid" value="{{ request.session.info.employeeid }}">
                    <label>新密码：</label><input class="form-control" name="password1" id="id_password1"
                                                 type="password">
                    <label>确认密码：</label><input class="form-control" name="password2" id="id_password2"
                                                   type="password" onblur="check()">
                    <div style="margin-top: 10px">
                        <button type="submit" class="btn btn-primary btn-sm" id="btn1" disabled>保存</button>
                    </div>
                </form>

            </div>
            <script type="text/javascript">
                function check() {
                    var pwd1 = document.getElementById("id_password1").value;
                    var pwd2 = document.getElementById("id_password2").value;
                    if (pwd1 != pwd2)
                        alert("您两次输入的密码不不致");
                    else
                        document.getElementById("btn1").disabled = false;
                }
            </script>

            {% if messages %}
                <div class="panel-body">
                    {% for message in messages %}
                        <div class="alert alert-danger" role="alert">
                            <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
                        </div>
                    {% endfor %}
                </div>
            {% endif %}
        </div>

            <h4 style="text-align: center; color: red">{{ msg }}</h4>

    </div>
{% endblock %}